package org.jvending.provisioning.config.adapters.impl;

public class DescriptorFileTypeHandler extends org.apache.ws.jaxme.impl.JMSAXElementParser {
    /**
     * The current state. The following values are valid states:
     * 0 = Before parsing the element
     * 1 = While or after parsing the child element {http://java.sun.com/xml/ns/j2ee-cp}extension
     * 2 = While or after parsing the child element {http://java.sun.com/xml/ns/j2ee-cp}mime-type
     */
    private int __state;


    public boolean startElement(java.lang.String pNamespaceURI, java.lang.String pLocalName, java.lang.String pQName, org.xml.sax.Attributes pAttr) throws org.xml.sax.SAXException {
        org.apache.ws.jaxme.impl.JMUnmarshallerHandlerImpl _1 = getHandler();
        switch (__state) {
            case 0:
                if ("http://java.sun.com/xml/ns/j2ee-cp".equals(pNamespaceURI) && "extension".equals(pLocalName)) {
                    __state = 1;
                    _1.addSimpleAtomicState();
                    return true;
                }
                break;
            case 1:
                if ("http://java.sun.com/xml/ns/j2ee-cp".equals(pNamespaceURI) && "mime-type".equals(pLocalName)) {
                    __state = 2;
                    _1.addSimpleAtomicState();
                    return true;
                }
                break;
            case 2:
                break;
            default:
                throw new java.lang.IllegalStateException("Invalid state: " + __state);
        }
        return false;
    }

    public void endElement(java.lang.String pNamespaceURI, java.lang.String pLocalName, java.lang.String pQName, java.lang.Object pResult) throws org.xml.sax.SAXException {
        org.jvending.provisioning.config.adapters.DescriptorFileType _1 = (org.jvending.provisioning.config.adapters.DescriptorFileType) result;
        switch (__state) {
            case 1:
                if ("http://java.sun.com/xml/ns/j2ee-cp".equals(pNamespaceURI) && "extension".equals(pLocalName)) {
                    _1.setExtension((java.lang.String) pResult);
                    return;
                }
                break;
            case 2:
                if ("http://java.sun.com/xml/ns/j2ee-cp".equals(pNamespaceURI) && "mime-type".equals(pLocalName)) {
                    _1.setMimeType((java.lang.String) pResult);
                    return;
                }
                break;
            default:
                throw new java.lang.IllegalStateException("Illegal state: " + __state);
        }
    }

    public boolean isFinished() {
        switch (__state) {
            case 2:
                return true;
            default:
                return false;
        }
    }

}
